package com.zbg.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ServletContext extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println(getServletContext().getContextPath()+"项目路径");
        System.out.println(getServletContext().getRealPath("/")+"绝对路径");
        System.out.println(getServletContext().getInitParameter("userName")+"="+getServletContext().getInitParameter("pwd"));
    }
}
